﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;

namespace IEWebSite.Administration
{
    public partial class Colective : System.Web.UI.Page
    {
        SqlConnection sqlConn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["SiteIEConnectionString"].ConnectionString);
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void ColectivBtnAdd_Click(object sender, EventArgs e)
        {

            try
            {
                sqlConn.Open();
                SqlCommand sqlCmd = new SqlCommand("INSERT INTO SysColectiv(SysNumeColectiv) VALUES (@SysNumeColectiv)", sqlConn);
                sqlCmd.Parameters.Add(new SqlParameter("@SysNumeColectiv", txtColectiv.Text));
                sqlCmd.ExecuteNonQuery();
                txtColectiv.Text = "";
            }
            catch (Exception ex)
            {
                lblError.Text = "Eroare: " + ex.Message;
            }
            finally
            {
                sqlConn.Close();
            }
            colectivGvName.DataBind();
        }
    }
}
